package com.lanou3g.myapplication.activity.singleton.activity;

import android.app.Activity;
import android.app.Application;
import android.content.Context;

import com.lanou3g.myapplication.DayNightMode;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by dllo on 16/1/15.
 */
public class ListActivity extends Application{
    private static Context context;

    @Override
    public void onCreate() {
        super.onCreate();
        ListActivity.context = this;
    }

    public static Context getContext() {
        return ListActivity.context;
    }

    public static List<Activity> activities;

    public static void addActivity(Activity activity){
        if (activities == null){
            activities = new ArrayList<>();
        }
        activities.add(activity);
    }

    public static void finishAll(){
        for (Activity activity:activities){
            activity.finish();
        }
    }

    public static void removeActivity(Activity activity){
        activities.remove(activity);
    }
}
